<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function Stu(uname, id, sex, grade) {
            this.name = uname;
            this.id = id;
            this.sex = sex;
            this.grade = grade;
            this.sayHi = function(intro) {
                alert(intro);
            }
        }
        var xiaoming = new Stu('小明', 1234, '男', '三年级');
        console.log(xiaoming.grade);
        console.log(xiaoming['id']);
        xiaoming.sayHi('你好我是小明');
    </script>
</head>

<body>

</body>

</html>